package com.tron.dobest.java.tronannotation;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.Arrays;

/**
 * @description 注解演示
 * @auther TRON
 * @create 2020-02-26
 */
public class Start {
    public static void main(String[] args) {

        Class<Start> startClass = Start.class;
        //获取当前类所有方法
        Method[] declaredMethods = startClass.getDeclaredMethods();
        for (Method declaredMethod : declaredMethods) {
            //获取方法上的所有注解
            Annotation[] declaredAnnotations = declaredMethod.getDeclaredAnnotations();
            for (Annotation declaredAnnotation : declaredAnnotations) {
                if (declaredAnnotation instanceof TronAnnotationOne) {
                    //输出注解上的值
                    TronAnnotationOne tronAnnotationOne = (TronAnnotationOne) declaredAnnotation;
                    System.out.println(tronAnnotationOne.a());
                    System.out.println(tronAnnotationOne.b());
                    System.out.println(tronAnnotationOne.c());
                    System.out.println(Arrays.toString(tronAnnotationOne.d()));
                    System.out.println(tronAnnotationOne.e());
                    System.out.println(tronAnnotationOne.value());
                    System.out.println(TronAnnotationOne.PREFIX);

                }
            }
        }
    }

    @TronAnnotationOne(b = 2,c = false,e = ForAnnotationData.class)
    public static void test01(Integer a) {

    }
}
